<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>反转字符串</title>
</head>
<body>
  <script>
    function fn(s) {
      let l = 0, r = s.length - 1;
      while (l < r) {
        [s[l], s[r]] = [s[r], s[l]];
        l++;
        r--;
      }
      return s;
    }
    console.log(fn(["h", "e", "l", "l", "o"]))
  </script>
</body>
</html>